package cn.mcch.investigator.dialog;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import cn.mcch.investigator.R;
import cn.mcch.investigator.application.InvestigatorApplication;
import cn.mcch.investigator.listener.OnCommonClickListener;

/**
 * Created by Administrator on 2016/12/17.
 */
public class ExitDialog extends BaseDialog implements View.OnClickListener {

    private String msg;
    private String negative;
    private String positive;
    private OnCommonClickListener l;

    @Override
    protected void initEventListener() {
        setOnClickListener(l, R.id.sb_exit);
        findViewById(R.id.sb_cancel).setOnClickListener(this);
    }

    @Override
    protected View initView(LayoutInflater inflater, ViewGroup container) {
        return View.inflate(InvestigatorApplication.getInstance(), R.layout.dialog_exit, null);
    }

    @Override
    public void initData() {
        setText(R.id.tv_dialog_msg, msg);
        setText(R.id.sb_cancel,negative);
        setText(R.id.sb_exit,positive);
    }

    public ExitDialog setOnClickListener(OnCommonClickListener l) {
        this.l = l;
        return this;
    }

    public ExitDialog setNegative(String negative) {
        this.negative = negative;
        return this;
    }

    public ExitDialog setPositive(String positive) {
        this.positive = positive;
        return this;
    }

    public ExitDialog setMessage(String msg) {
        this.msg = msg;
        return this;
    }

    @Override
    public void onClick(View v) {
        dismiss();
    }
}
